<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>日志查询</title>
  <script src="js/jquery.js"></script>
  <script src="js/laydate/laydate.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
  <style>
    caption{color: #000;font-weight: bold;}
    .table div{display: inline-block;}
    .form-inline .w150{width: 160px;}.form-inline .w100{width: 100px;}.form-inline .w40{width: 60px;}
  </style>
</head>
<body>
<div class="container">
    <div class="row" style="padding-top:20px;">
        <form class="form-inline" method="get">
          <div class="form-group">
            <label>服务器</label>
            <select name="address" class="form-control">
              <option value="">所有</option>
              {list $ip_list}
              <option value="{$data}">{$data}</option>
              {/list}
            </select>
          </div>
          <div class="form-group">
            <select name="type" class="form-control">
              <option value="">类型</option>
              {list $type_list}
              <option value="{$key}">{$data}</option>
              {/list}
            </select>
          </div>
          <div class="form-group">
            <select name="module" class="form-control">
              <option value="">模块</option>
              {list $module_list}
              <option value="{$key}">{$data}</option>
              {/list}
            </select>
          </div>
          <div class="form-group">
            <label>name</label>
            <input type="text" class="form-control" name="name" value="{?$post['name']}" placeholder="">
          </div>
          <div class="form-group">
            <label>code</label>
            <input type="text" class="form-control w100" name="code" value="{?$post['code']}">
          </div>
          <div class="form-group">
            <label>msg</label>
            <input type="text" class="form-control" name="msg" value="{?$post['msg']}" placeholder="日志内容">
          </div><br>
          <div class="form-group">
            <label>时间</label>
            <input type="text" autocomplete="off" class="form-control w150" name="start" id="start" value="{?$start}" placeholder="开始时间">
          </div>
          <div class="form-group">
            <input type="text" autocomplete="off" class="form-control w150" name="end" id="end" value="{?$end}" placeholder="结束时间">
          </div>
          <button type="submit" class="btn btn-default">查询</button>
        </form>
        <div class="table-responsive" style="padding-top:20px;">
            <table class="table">
              <caption>日志记录</caption>
              <thead>
                <tr>
                  <th>服务器</th>
                  <th>日志</th>
                </tr>
              </thead>
              <tbody>
              {list $ret}
                <tr>
                  <td>{$key}</td>
                  <td>{*nl2br($data)}</td>
                </tr>
              {/list}
              </tbody>
            </table>

        </div>
    </div>
</div>

<script>
    function G(itm){var element=document.getElementById(itm);if(!element){element=document.getElementsByName(itm)[0]}return element}
    function autoCheckbox(itm,val,s){var o=document.getElementsByName(itm);if(!o) return;s=s||',';var vals=val.split(s);for(var s=0;s<vals.length;s++){for(i=0;i<o.length;i++){if(o[i].value==trim(vals[s])){o[i].checked=true;break}}}}
    function autoRadio(itm,val){var o=document.getElementsByName(itm);if(!o) return;for(var i=0;i<o.length;i++){if(o[i].value==val){o[i].checked=true;break}}}
    function autoInput(itm,val){var o=G(itm);if(!o) return;o.value=val}
    function autoSelect(itm,val){var o=G(itm);if(!o) return;for(i=0;i<o.options.length;i++){if(o.options[i].value==val){o.selectedIndex=i;break}}}
    autoSelect("address","{$address}");
    autoSelect("type","{?$post['type']}");
    autoSelect("module","{?$post['module']}");
    //时间选择器
    laydate.render({
        elem: '#start',type: 'datetime'
    });
    laydate.render({
        elem: '#end',type: 'datetime'
    });
</script>
</body>
</html>